package com.zx.练习题.demo;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class T4 {

    public static void main(String[] args) {
        int a = 1;
        int b = 2;

        for (int i = 1; i <= 31; i++) {
            int c = (1 << i);
            log.info("id={}, num={}, bin={}", i, c, format(Integer.toBinaryString(c)));
        }

    }


    public static String format(String s) {
        int len = s.length();
        String res = "";

        for (int i = 0; i < 32 - len; i++) {
            res += "0";
        }
        return res + s;
    }

}
